package com.franklin.java.completion.convert;

import com.franklin.java.completion.AbstractJavaDataCompletionContributor;
import com.franklin.java.utils.CompletionUtils;
import com.franklin.java.utils.PsiUtils;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.lookup.LookupElement;

import java.util.ArrayList;
import java.util.List;

/**
 * 转换代码提示
 * @author Franklin
 * @since 2021/8/4 14:59
 */
public class JavaDataConvertCompletionContributor extends AbstractJavaDataCompletionContributor {

    @Override
    public List<LookupElement> getLookupElements(CompletionParameters parameters) {
        List<LookupElement> results = new ArrayList<>();
        results.add(CompletionUtils.getLookElement("toint","Integer","StringUtilFly.ObjectToInt($EXPR$)","EXPR","  cast object to integer",0));
        results.add(CompletionUtils.getLookElement("tolong","Long","StringUtilFly.ObjectToLong($EXPR$)","EXPR","  cast object to long",0));
        results.add(CompletionUtils.getLookElement("todouble","Double","Double.parseDouble($EXPR$)","EXPR","  cast object to double",0));
        results.add(CompletionUtils.getLookElement("tofloat","Float","Float.parseFloat($EXPR$)","EXPR","  cast object to float",0));
        results.add(CompletionUtils.getLookElement("todecimal","BigDecimal","new BigDecimal($EXPR$)","EXPR","  cast object to big decimal",0));
        results.add(CompletionUtils.getLookElement("tobigint","BigInteger","new BigInteger($EXPR$)","EXPR","  cast object to big integer",0));
        results.add(CompletionUtils.getLookElement("tolist","List","Collections.singletonList($EXPR$)","EXPR","  cast object to singleton list",0));
        results.add(CompletionUtils.getLookElement("toset","Set","Collections.singleton($EXPR$)","EXPR","  cast object to singleton set",0));
        return results;
    }

}
